#include "StdAfx.h"
#include "RobotInstance.h"

namespace RobotPlant { namespace RobotProxy{

	RobotInstance::RobotInstance(string soapServer,joint::spawn_type e):joint(e)
	{
		_soapServer = soapServer;
	}

	RobotInstance::~RobotInstance()
	{
	}

	string RobotInstance::GetSoapServer()
	{
		boost::mutex::scoped_lock lock(_mutex);

		string soapServer;
		soapServer = _soapServer;

		return soapServer;
	}

	boost::shared_ptr<DeviceBase> RobotInstance::GetDevice(int index)
	{
		boost::mutex::scoped_lock lock(_mutex);

		boost::shared_ptr<DeviceBase> rob;
		if((index >= 0) && (index < _devices.size()))
			rob = _devices[index];

		return rob;
	}

	/*
	Gets the robot instances' count.
	*/
	int RobotInstance::GetDeviceCount()
	{
		boost::mutex::scoped_lock lock(_mutex);

		int deviceCount = 0;
		deviceCount = _devices.size();

		return deviceCount;
	}
}}